Skip to content

Fix Vault.logical.read NoMethodError on HTTP 204 responses - #386

Merged
chrisarcand merged 1 commit into
masterfrom
fix-241-logical-read-204-response
Feb 4, 2026
Merged

Fix Vault.logical.read NoMethodError on HTTP 204 responses#386
chrisarcand merged 1 commit into
masterfrom
fix-241-logical-read-204-response

Conversation

@chrisarcand

Copy link
Copy Markdown
Member

When Vault responds with HTTP 204 (No Content), the client.get() method returns nil. Previously, this nil was passed directly to Secret.decode(), which attempted to call .each on nil, resulting in a NoMethodError.

This commonly occurred when reading from PKI engines without configured certificates, or any other endpoint that legitimately returns 204 No Content.

Now Vault.logical.read() returns nil when the response is empty, consistent with its behavior for 404 responses.

Fixes #241

When Vault responds with HTTP 204 (No Content), the client.get()
method returns nil. Previously, this nil was passed directly to
Secret.decode(), which attempted to call .each on nil, resulting
in a NoMethodError.

This commonly occurred when reading from PKI engines without
configured certificates, or any other endpoint that legitimately
returns 204 No Content.

Now Vault.logical.read() returns nil when the response is empty,
consistent with its behavior for 404 responses.

Fixes #241
@chrisarcand
chrisarcand requested a review from a team as a code owner February 4, 2026 00:04
@chrisarcand
chrisarcand merged commit 333419f into master Feb 4, 2026
27 of 28 checks passed
@chrisarcand
chrisarcand deleted the fix-241-logical-read-204-response branch February 4, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vault.logical.read throws NoMethodError when Vault responds with HTTP 204 (No Content)

2 participants